package com.winner.lps.common.utils;

import com.github.stuxuhai.jpinyin.PinyinException;
import com.github.stuxuhai.jpinyin.PinyinFormat;
import com.github.stuxuhai.jpinyin.PinyinHelper;

/**
 * Created by chengshaowei on 2016/12/21.
 */
public class PinyinUtils {
    public static void main(String args[]) {
        try {
            String str = "你好世界";
            PinyinHelper.convertToPinyinString(str, ",", PinyinFormat.WITH_TONE_MARK); // nǐ,hǎo,shì,jiè
            PinyinHelper.convertToPinyinString(str, ",", PinyinFormat.WITH_TONE_NUMBER); // ni3,hao3,shi4,jie4
            PinyinHelper.convertToPinyinString(str, ",", PinyinFormat.WITHOUT_TONE); // ni,hao,shi,jie
            PinyinHelper.getShortPinyin(str); // nhsj
        } catch (PinyinException e) {
            e.printStackTrace();
        }
    }
}
